const path=require('path');
const HtmlPlugin=require('html-webpack-plugin');
const htmlPlugin=new HtmlPlugin({
    template:path.join(__dirname,'src/index.html'),
    filename:'index.html'
});
module.exports={
    mode:'development',
    entry:'./src/index.js',
    output:{
        path:path.join(__dirname,'dist'),
        filename:'main.js'
    },
    module:{
        rules:[
            {
                test:/\.css$/,
                use:['style-loader','css-loader']
            },
            {
                test:/.less/,
                use:['style-loader','css-loader','less-loader']
            },
            {
                test: /\.js|jsx$/,
                use: {
                    loader: 'babel-loader'
                },
                exclude: /node_modules/
            }
        ]
    },
    plugins:[htmlPlugin],
    resolve:{
        extensions:['.jsx','.js','json'],
        alias:{
            '@':path.join(__dirname,'src')
        }
    }
}